package com.yeyks.app.controller.base.other;

import com.yeyks.app.annotation.LoadUserId;
import com.yeyks.common.ajax.AjaxResponseBody;
import com.yeyks.commonReference.pojo.param.other.InvoiceInfo.CreateInvoiceParam;
import com.yeyks.commonReference.pojo.param.other.InvoiceInfo.PreInvoicingOrderListParam;
import com.yeyks.commonReference.pojo.param.other.InvoiceInfo.PreInvoicingRechargeListParam;
import com.yeyks.commonReference.pojo.vo.other.InvoiceInfo.PreInvoicingOrderListVo;
import com.yeyks.commonReference.pojo.vo.other.InvoiceInfo.PreInvoicingRechargeListVo;
import com.yeyks.commonReference.service.other.InvoiceInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "发票", description = "发票")
@RestController
@RequestMapping("/app/invoiceinfo")
public class InvoiceInfoController {

    @Autowired
    private InvoiceInfoService invoiceInfoService;

    @ApiOperation(value = "获取可以开发票的订单列表v4.2.0")
    @PostMapping(value = "/get_pre_invoicing_order_list")
    public AjaxResponseBody<PreInvoicingOrderListVo> getPreInvoicingOrderList(@LoadUserId PreInvoicingOrderListParam param) {
        return AjaxResponseBody.success(invoiceInfoService.getPreInvoicingOrderList(param));
    }

    @ApiOperation(value = "获取未开发票的充值订单v4.2.0")
    @PostMapping(value = "/get_pre_invoicing_rechange_list")
    public AjaxResponseBody<PreInvoicingRechargeListVo> getPreInvoicingRechangeList(@LoadUserId PreInvoicingRechargeListParam param) {
        return AjaxResponseBody.success(invoiceInfoService.getPreInvoicingRechangeList(param));
    }

    @ApiOperation(value = "下发票订单v4.2.0")
    @PostMapping(value = "/get_create_invoice")
    public AjaxResponseBody<Boolean> getCreateInvoice(@LoadUserId @Validated CreateInvoiceParam param) {
        return AjaxResponseBody.success(invoiceInfoService.getCreateInvoice(param));
    }

}
